<script setup>
import { computed } from 'vue'
import { useRoute } from 'vue-router'
import { useAuthStore } from './store/auth.js'

const route = useRoute()
const authStore = useAuthStore()

// 判断是否为登录页面
const isLoginPage = computed(() => {
  return route.path === '/login'
})

// 获取用户信息
const userInfo = computed(() => authStore.userInfo)
</script>

<template>
  <div id="app">
    <!-- 登录页面不使用布局组件 -->
    <router-view v-if="isLoginPage" />
    
    <!-- 其他页面使用布局组件 -->
    <router-view v-else />
  </div>
</template>

<style>
/* 全局样式重置 */
* {
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  width: 100%;
  margin: 0 !important;
  padding: 0 !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'kern';
  color: #1f2937;
  line-height: 1.5;
  overflow-x: hidden;
}

#app {
  height: 100vh;
  width: 100vw;
  min-height: 100vh;
  min-width: 100vw;
  position: fixed;
  top: 0;
  left: 0;
  margin: 0 !important;
  padding: 0 !important;
  overflow-x: hidden;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  position: relative;
}

/* Element Plus 样式调整 */
.el-message {
  z-index: 3000;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.el-loading-mask {
  z-index: 2000;
  backdrop-filter: blur(4px);
}

.el-button {
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
}

.el-button--primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 10px;
  font-weight: 600;
  letter-spacing: 0.025em;
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
  transition: all 0.3s ease;
}

.el-button--primary:hover,
.el-button--primary:focus {
  background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.el-card {
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  border: 1px solid #e5e7eb;
  background: #ffffff;
  transition: all 0.15s ease;
}

.el-table {
  border-radius: 8px;
  overflow: hidden;
}

.el-table th {
  background: #f8fafc !important;
  color: #4a5568;
  font-weight: 600;
  border-bottom: 1px solid #e2e8f0;
}

.el-table td {
  border-bottom: 1px solid #f1f5f9;
}

.el-table tr:hover > td {
  background: #f8fafc !important;
}

.el-input__wrapper {
  border-radius: 8px;
  transition: all 0.15s ease;
  border: 1px solid #d1d5db;
  background: #ffffff;
}

.el-input__wrapper:hover {
  border-color: #9ca3af;
}

.el-input__wrapper.is-focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.el-select .el-input__wrapper {
  border-radius: 8px;
}

.el-dialog {
  border-radius: 16px;
  overflow: hidden;
}

.el-dialog__header {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  padding: 24px 24px 16px;
  border-bottom: 1px solid #e2e8f0;
}

.el-dialog__title {
  font-weight: 600;
  color: #1a202c;
}

.el-dialog__body {
  padding: 24px;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #f8fafc;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
  transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* 动画效果 */
.fade-enter-active,
.fade-leave-active {
  transition: all 0.3s cubic-bezier(0.2, 0, 0, 1);
}

.fade-enter-from,
.fade-leave-to {
  opacity: 0;
  transform: translateY(8px);
}

.slide-fade-enter-active {
  transition: all 0.3s ease-out;
}

.slide-fade-leave-active {
  transition: all 0.2s cubic-bezier(1, 0.5, 0.8, 1);
}

.slide-fade-enter-from,
.slide-fade-leave-to {
  transform: translateX(10px);
  opacity: 0;
}

/* 卡片样式 */
.card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  border: 1px solid #f1f5f9;
  transition: all 0.3s ease;
}

.card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
  transform: translateY(-2px);
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid #f1f5f9;
  font-weight: 600;
  color: #1a202c;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.card-body {
  padding: 24px;
}

/* 工具类 */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-left {
  text-align: left;
}

.mb-8 {
  margin-bottom: 8px;
}

.mb-16 {
  margin-bottom: 16px;
}

.mb-24 {
  margin-bottom: 24px;
}

.mb-32 {
  margin-bottom: 32px;
}

.mt-8 {
  margin-top: 8px;
}

.mt-16 {
  margin-top: 16px;
}

.mt-24 {
  margin-top: 24px;
}

.mt-32 {
  margin-top: 32px;
}

.p-16 {
  padding: 16px;
}

.p-24 {
  padding: 24px;
}

.p-32 {
  padding: 32px;
}

.px-16 {
  padding-left: 16px;
  padding-right: 16px;
}

.px-24 {
  padding-left: 24px;
  padding-right: 24px;
}

.py-16 {
  padding-top: 16px;
  padding-bottom: 16px;
}

.py-24 {
  padding-top: 24px;
  padding-bottom: 24px;
}

.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.w-full {
  width: 100%;
}

.h-full {
  height: 100%;
}

.rounded {
  border-radius: 8px;
}

.rounded-lg {
  border-radius: 12px;
}

.rounded-xl {
  border-radius: 16px;
}

.shadow {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
}

.shadow-lg {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
}

.shadow-xl {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1), 0 4px 10px rgba(0, 0, 0, 0.06);
}

.gradient-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.gradient-bg {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.text-primary {
  color: #667eea;
}

.text-secondary {
  color: #64748b;
}

.text-muted {
  color: #94a3b8;
}

.bg-primary {
  background-color: #667eea;
}

.bg-secondary {
  background-color: #f8fafc;
}

.border {
  border: 1px solid #e2e8f0;
}

.border-primary {
  border-color: #667eea;
}

.hover-lift:hover {
  transform: translateY(-2px);
  transition: transform 0.2s ease;
}
</style>
